List View Genie

Description

The List View Genie allows you to present a user with either an attractive, well formatted, and easy-to-use static list of choices or a dynamic list of choices and return the user's selection. You can:

  • allow single or multiple selections

  • hide or display column headers, grid lines, and scroll bars

With dynamic lists you can:

  • present any field retrieved from an Alpha Anywhere, ADO compatible, or ODBC compatible database

  • filter the records you retrieve with an Xbasic or SQL SELECT statement

  • order the records you retrieve with an Xbasic or SQL SELECT statement

  • pre-populate the lists before the control displays

  • retrieve data for the lists as it is needed

While very similar, there are important differences between a Pre-populated List and a Dynamically Bound List.

To create a list view style Xdialog.

  1. Create a new Action Script.

  2. Select "Xdialog Windows" in the Category list.

  3. Select "Display an XDialog Box" in the Action list.

  4. Click OK to display the Script Genie.

  5. Enter the name of new variable in the Variable Name field.

  6. Optionally, change the value of the Prompt field.

  7. Optionally, change the selection in the data Type list.

  8. Select "List View style Dialog" in the Style list.

  9. Set the Width and Height of the resulting dialog box.

  10. Click Define List View Control to display the List View Builder.

  11. Continue with Data_Selection.

    images/AS_List_View_Dialog.gif
  12. Click OK to exit from the List View Genie.

  13. Optionally click the Preview button to see what the new dialog box will look like.

  14. Click Next >.

  15. Optionally, enter the title of the dialog box in the Dialog Title field.

  16. Optionally, enter text to appear at the top of the dialog box into the Header Text field.

  17. Optionally, enter text to appear at the bottom of the dialog box into the Footer Text field.

  18. Optionally, modify the bottom labels in the Button Text fields.

  19. Click Next >.

  20. Optionally, modify the name of the variable in the Variable Name field that will capture the return value of the Xdialog box.

  21. Optionally, change the Scope of the return variable to one the following values. A variable's scope refers to where the variable can be seen, i.e. which other scripts can access the variable.

    • "Shared". Variables are available throughout the current form.

    • "Global". Variables are available anywhere in Alpha Anywhere.

    • "Local". Variables are available only in the current script.

  22. Click Next >.

  23. Optionally, modify the comment that describes the action.

  24. Click Finish.

Data Selection

  1. In the Data Selection > Populate method field select you are going to provide the data that the control will display. The options are:

    • "Pre-populate from Static List"

    • "Pre-populate from Data Source"

    • "Dynamically Bound"

  2. If you selected "Pre-populate from Static List" in step 1, continue with Pre-populate from Static List.

  3. If you selected "Pre-populate from Data Source" or "Dynamically Bound" in step 1, continue with Pre-Populate from Data Source.

Pre-populate from Static List

  1. Click the '...' button in the Data Selection > Choices field to display the Static List dialog.

  2. Optionally, change the character (default "|") used as a field delimiter in the Column delimiter field.

  3. Optionally, change the characters used as a record delimiter in the Row delimiter field. The valid entries are: and any other printable character(s) such as |,#@^.

  4. Enter the column headers, with fields separated by your selected delimiters.

  5. Enter data, one row per record, with fields and records separated by your selected delimiters. The {DATA=<return_value>}<display_value> syntax allows you to return the specified <return_value> when the user clicks on a row that displays <display_value>.

  6. Click OK to continue.

    • The following lines show some sample data:

      Id|First name|Last Name|City
      {DATA=00000001}00000001|Michael|Graham|Natick
      {DATA=00000002}00000002|Sally|Peabody|Brockton
      {DATA=00000003}00000003|Janet|Rebo|Keene
      {DATA=00000004}00000004|David|Mesner|York Beach
      images/AS_List_View_Static_List.gif

Pre-Populate from Data Source

  1. Make a selection from the Data Selection > Data source field. The options are:

    • "DBF Table"

    • "Access Database"

    • "ADO Data Source"

  2. If you selected "DBF Table"in step 1, continue with DBF Table.

  3. If you selected "Access Database"in step 1, continue with Access Database.

  4. If you selected "ADO Data Source"in step 1, continue with ADO Data Source.

DBF Table

  1. Select a table in the Data Selection > Table name list.

  2. Optionally, click in the Data Selection > Arguments field to define the arguments that you will use in a filter expression.

  3. Click the '...' button in the Data Selection > Field list field to select the fields to display the Select Fields dialog box.

  4. Optionally, enter a filter expression that selects records into the Data Selection > Filter/Where Clause field. For assistance, click to display the Expression Builder and press F10 to see a list of arguments.

  5. Optionally, enter an expression that orders records in the Data Selection > Order field. For assistance, click to display the Order Builder.

  6. Select the field to return from the Data Selection > Field to Return list.

  7. Optionally, click the '...' button in the Data Selection > Arguments field to display the Define Arguments dialog. This dialog defines parameters to use in the query's filter or where clause. Arguments allow you to customize at runtime the data displayed in the list.

  8. Continue with Display Options.

Access Database

  1. Click the 'open file' icon in the Data Selection > Choices field to select the Access database.

    images/Folder_button.gif
  2. Optionally, click in the Data Selection > Arguments field to define the arguments that you will use in a filter expression.

  3. Make a selection in the Data Selection > Populate from list. The options are:

    • "Table"

    • "SQL"

  4. If you selected "Table" in step 3:

    • 1. Select a table from the Data Selection > Table name list.

    • 2. Click the '...' button in the Data Selection > Field list field to select the fields to display the Select Fields dialog box.

    • 3. Optionally, enter a filter expression that selects records into the Data Selection > Filter/Where Clause field. For assistance, click to display the Specify Filter dialog box.

    • 4. Optionally, click in the Data Selection > Order field to enter an expression that orders records. For assistance, click to display the Specify Order dialog.

  5. If you selected "SQL" in step 2, click the '...' button in the Data Selection > SQL Select Statement field to define the SQL Select statement in the Define SQL Statement dialog box.

  6. Select the field to return from the Data Selection > Field to Return list.

  7. Optionally, click the '...' button in the Data Selection > Arguments field to display the Define Arguments dialog. This dialog defines parameters to use in the query's filter or where clause. Arguments allow you to customize at runtime the data displayed in the list.

  8. Continue with Display Options.

ADO Data Source

  1. Click the '...' button in the Data Selection > Connection String field to display the Connection String dialog.

  2. Optionally, click in the Data Selection > Arguments field to define the arguments that you will use in a filter expression.

  3. Make a selection in the Data Selection > Populate from list. The options are:

    • "Table"

    • "SQL"

  4. If you selected "Table" in step 3:

    • 1. Select a table from the Data Selection > Table name list.

    • 2. Click the '...' button in the Data Selection > Field list field to select the fields to display the Define SQL Statement dialog box.

    • 3. Optionally, enter a filter expression that selects records into the Data Selection > Filter/Where Clause field. For assistance, click to display the Specify Filter dialog box.

    • 4. Optionally, click in the Data Selection > Order field to enter an expression that orders records. For assistance, click to display the Specify Order dialog box.

  5. If you selected "SQL" in step 2, click the '...' button in the Data Selection > SQL Select Statement field to define the SQL Select statement in the Define SQL Statement dialog box.

  6. Select the field to return from the Data Selection > Field to Return list.

  7. Optionally, click the '...' button in the Data Selection > Arguments field to display the Define Arguments dialog. This dialog defines parameters to use in the query's filter or where clause. Arguments allow you to customize at runtime the data displayed in the list.

  8. Continue with Display Options.

Display Options

  1. To enable advanced formatting, check Display Options > Enable Advanced Formatting.

  2. Click the '...' button in the Display Options > Define Advanced Formatting field to display the Advanced Formatting dialog box and display colors, tab stop positioning, fonts, and numbering.

  3. To suppress column titles, check Display Options > Do not show column header.

  4. To allow multiple selections, clear Display Options > Do not allow multiple selections.

  5. When enabled, the Display Options > Full row selection option allows the user to select the entire row. When disabled, the user can only select data in the first column.

  6. The Display Options > Enable sorting option enables and disables the ability to sort the data in the list view by clicking on a column title.

  7. When enabled, the Display Options > Always show selection bar option highlights the current row, even when the control does not have focus.

  8. The Display Options > Show grid lines option displays and hides grid lines.

The Preview button provides a quick preview of the list view with several rows of data.

Connection String Dialog Box

  1. Enter the connection string for your database.

  2. Optionally, click Build to display the Windows Data Link Properties dialog.

  3. Click OK to continue.

    images/AS_Connection_String_dialog_box.gif

Limitations

Desktop applications only. Not available in Community Edition.

See Also